package tests;

import static org.junit.Assert.*;

import java.util.List;

import org.junit.Before;
import org.junit.Test;

import users.Author;

/**
 * Junit test for the Author class. 
 * @author Lun-Wei Chang
 * @version 3/19/2014
 */
public class AuthorTest {
  
  /** The ID that this role is represented by. */
  public static final long ROLE_ID = 3;
  
  /** The author's role id. */
  private long my_role_id;
  
  /** The list of manuscripts that the Author has submitted to the conference.*/
  private List<Long> my_manuscripts;
  
  /** The Name that this role is represented by. */
  private String my_role_name;

  /** 
   * Constructs a new Author role with minimal information. 
   * @throws Exception 
   */
  @Before
  public void setUp() throws Exception {
    final Author person = new Author(ROLE_ID);
    my_role_id = person.getRoleID();
    my_manuscripts = person.getManuscripts();
    my_role_name = person.getRoleName();
  }
  
  /** Checks if the author can get a list of Manuscripts. */
  @Test
  public void getManuscripts() {
    assertNotNull("Manuscript list is empty. ", my_manuscripts);
  }
  
  /** Checks if the author has the correct role id. */
  @Test
  public void getRoleID() {
    assertNotNull("Empty role ID!", my_role_id);
    assertEquals("Incorrect role id! ", ROLE_ID, my_role_id);
  }
  
  /** Checks if the author has the correct role name. */
  @Test
  public void getRoleName() {
    assertNotNull("Missing Role name! ", my_role_name);
    assertEquals("Wrong role name!", "Author", my_role_name);
  }

}
